package com.example.nonggo.api;


import com.example.nonggo.bean.AiWeatherRes;
import com.example.nonggo.bean.BdsoundVO;
import com.example.nonggo.bean.Category;
import com.example.nonggo.bean.ConditionRes;
import com.example.nonggo.bean.Forecast15DaysRes;
import com.example.nonggo.bean.GoodsPrice;
import com.example.nonggo.bean.LoginNameRes;
import com.example.nonggo.bean.LoginRes;
import com.example.nonggo.bean.MBaseData;
import com.example.nonggo.bean.PresetQuestionRes;
import com.example.nonggo.bean.PriceAverageByDateVO;
import com.example.nonggo.bean.ShowIconTab;
import com.example.nonggo.bean.VarietyMarketDetailRes;
import com.example.nonggo.bean.Weather24HoursRes;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Url;

public interface BaseApi {
    @POST("app-api/member/auth/send-sms-code")
    Observable<MBaseData<Boolean>> getSmsCode(@Body RequestBody jsonInfo);

    @POST("app-api/member/auth/sms-login")
    Observable<MBaseData<LoginRes>> login(@Body RequestBody jsonInfo);

    @POST("app-api/v1/mojiweather/getCondition")
    Observable<MBaseData<ConditionRes>> getCondition(@Header("authorization") String token, @Body RequestBody jsonInfo);

    @GET("app-api/ai/preset-questions/page")
    Observable<MBaseData<PresetQuestionRes>> getPresetQuestions(
            @Header("Authorization")
            String token,
            @Query("pageNo") String pageNo,
            @Query("pageSize") String pageSize);

    @POST
    Observable<MBaseData<String>> getWearChatMessages(@Url String url, @Header("authorization") String token, @Body RequestBody jsonInfo);

    @POST
    Observable<MBaseData<LoginNameRes>> getLocationName(@Url String url, @Body RequestBody jsonInfo);

    @POST("app-api/v1/interpret/report/detail")
    Observable<MBaseData<AiWeatherRes>> getAiDetail(@Header("authorization") String token, @Body RequestBody jsonInfo);

    @POST("app-api/v1/mojiweather/get5attrForec24Hours")
    Observable<MBaseData<Weather24HoursRes>> get24HoursWeatherData(@Header("authorization") String token, @Body RequestBody jsonInfo);

    @GET("app-api/ai/varieties/getTree?sourcePlatform=pfsc")
    Observable<MBaseData<List<Category>>> getMarketTrends(@Header("Authorization") String token);

    @POST("app-api/v1/mojiweather/getForecast15Days")
    Observable<MBaseData<Forecast15DaysRes>> getForecast15Days(@Header("authorization") String token, @Body RequestBody jsonInfo);

    /**
     * 获取价格列表
     * - 物品详情列表
     *
     * @param token 登录令牌
     * @return 价格列表
     */
    @POST("app-api/price/pageList")
    Observable<MBaseData<VarietyMarketDetailRes>> priceList(@Header("Authorization") String token, @Body RequestBody requestBody);

    /**
     * 获取单个物品的价格
     *
     * @param token 登录令牌
     * @return - 价格详情
     */
    @POST("app-api/price/minmax")
    Observable<MBaseData<GoodsPrice>> getGoodsPrice(@Header("Authorization") String token, @Body RequestBody requestBody);

    /**
     * 获取单个物品的近一个月价格趋势
     *
     * @param token       登录令牌
     * @param requestBody 查询参数 // {"varietyName":"面粉","beginTime":1738641599950,"endTime":1741233599950,"pageSize":31}
     * @return - 价格详情
     */
    @POST("app-api/price/averageByDate")
    Observable<List<PriceAverageByDateVO>> getAverageByDate(@Header("Authorization") String token, @Body RequestBody requestBody);

    /**
     * 语言转文字
     *
     * @param token       登录令牌
     * @param requestBody speech string 必填 本地语音文件的二进制语音数据 ，需要进行base64 编码。与len参数连一起使用。
     *                    len int 必填 本地语音文件的的字节数，单位字节
     * @return
     */
    @POST("app-api/chat/v1/bdsound")
    Observable<MBaseData<BdsoundVO>> bdsound(@Header("Authorization") String token, @Body RequestBody requestBody);

    /**
     * 提交专家问答的问题
     *
     * @param token       登录令牌
     * @param requestBody {
     *                    -- "applicationName": "nong",
     *                    -- "title": "蝴蝶兰适合什么样的土壤？是普通的园土，还是需要特殊的基质？",
     *                    -- "phone": "15626446758",
     *                    -- "showImgList": [],
     *                    -- "showVideoList": [],
     *                    -- "collectionTime": 1741410543421,
     *                    -- "recentMedication": "",
     *                    -- "occurrenceArea": "",
     *                    -- "openType": 0,
     *                    -- "recentWeather": "",
     *                    -- "assignmentDeptId": ""
     *                    -- }
     * @return
     */
    @POST("app-api/expert-question/create")
    Observable<MBaseData<Object>> submitQuestion(@Header("Authorization") String token, @Body RequestBody requestBody);
    @GET("app-api/zhonghua/show/showicon")
    Observable<MBaseData<ShowIconTab>> tab4(@Header("Authorization") String token);
    @GET("app-api/zhonghua/show/suncode")
    Observable<MBaseData<ShowIconTab>> tab4ImageDetail(@Header("Authorization") String token);
}
